package com.aaamvc.xml;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;

/**
 * 解析XML配置文件
 * @author Administrator
 *
 */
public class XmlParser
{

	public static List<String> getConfig() throws Exception
	{
		SAXReader reader = new SAXReader();
		InputStream in = XmlParser.class.getClassLoader().getResourceAsStream("aaamvc_config.xml");  
		Document doc = reader.read(in);  
		Element root = doc.getRootElement();  
		//存储读取的包名
		List<String> packages = new ArrayList<String>();
		
		
		Map<String, List<String>> packagesMap = new HashMap<String, List<String>>();
		
		for(Iterator iter = root.elementIterator(); iter.hasNext();)
		{
			Element e = (Element)iter.next();
			String packageName = e.attributeValue("base-package");
			packages.add(packageName);
		}
		return packages;
	}
	
	
	public static void main(String[] args) {

	}
	
	
	
	
	
	
	
	
	
	
	
	
	
}
